package com.trans.handler;

import com.trans.auxiliary.HandleFullRecord;
import com.trans.auxiliary.HandleRecord;
import com.trans.contants.StringConstant;
import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *@Description 是否转换
 *@Author xwduo
 *@Date 2022年03月01日 08:51
 **/
@Slf4j
public class Able implements TranslateHandle<String,String> {

    @Override
   public Object doHandle(HandleRecord record, Map<String, String> cacheMap) {
        Object curItemVal = record.getVal();
        if(null != curItemVal){
            String value = String.valueOf(curItemVal);
            return StringConstant.ZERO.equalsIgnoreCase(value)? StringConstant.NO:StringConstant.YES;
        }
        return null;
    }

    @Override
    public Map<String, String> cache(List<HandleFullRecord> recordList) {
        return new HashMap<>();
    }

    @Override
    public int order() {
        return 0;
    }

}
